#!/usr/bin/env bash

set -e

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
solc-select install 0.6.6
solc-select install 0.7.6
solc-select install 0.8.3

$SCRIPTPATH/native_solc6_compile Flags.sol
$SCRIPTPATH/native_solc6_compile Oracle.sol
$SCRIPTPATH/native_solc6_compile FluxAggregator.sol
$SCRIPTPATH/native_solc6_compile tests/VRFConsumer.sol
$SCRIPTPATH/native_solc6_compile VRFCoordinator.sol
$SCRIPTPATH/native_solc6_compile tests/VRFRequestIDBaseTestHelper.sol
$SCRIPTPATH/native_solc6_compile tests/VRFTestHelper.sol

$SCRIPTPATH/native_solc7_compile dev/Operator.sol
$SCRIPTPATH/native_solc7_compile tests/MultiWordConsumer.sol

$SCRIPTPATH/native_solc8_compile dev/Chainlink.sol
$SCRIPTPATH/native_solc8_compile dev/ChainlinkClient.sol
$SCRIPTPATH/native_solc8_compile dev/VRFRequestIDBase.sol
$SCRIPTPATH/native_solc8_compile dev/VRFConsumerBase.sol
